//
//  riliView.m
//  rili
//
//  Created by 张超 on 2017/9/20.
//  Copyright © 2017年 张超. All rights reserved.
//

#import "riliView.h"
#import "PickerChoiceView.h"



@interface riliView ()

@property (nonatomic, weak) IBOutlet UIButton *title;

@property (nonatomic, weak) IBOutlet UITextField *timer;

@end
@implementation riliView

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        self = [[[NSBundle mainBundle] loadNibNamed:@"riliView" owner:nil options:nil] lastObject];
    }
    return self;
}

+ (instancetype)riliview:(UITableView *)tableView; {
    
    static NSString *riliViewHeader = @"riliViewHeaderCell";
    
    riliView *rili = [tableView dequeueReusableHeaderFooterViewWithIdentifier:riliViewHeader];

    NSLog(@"%@",rili);
    
    if(rili == nil){
        
        rili = [[riliView alloc] initWithReuseIdentifier:riliViewHeader];
    }
    
    

    return rili;
}
- (void)setRiliModel:(ZLRiliModel *)riliModel {
    
    _riliModel = riliModel;
    [self.title setTitle:riliModel.title forState:UIControlStateNormal];
    if (riliModel.timer.length > 0) {
        
        self.timer.text = riliModel.timer;
    } else {
        self.timer.text = @"";
    }
   }

- (IBAction)btnClick:(id)sender {
    
    [self endEditing:YES];
    
    if (self.btnBlock) {
        self.btnBlock(sender);
    }
}

- (IBAction)addClick:(id)sender {
    
    [self endEditing:YES];
    
    if (self.addBlock) {
        self.addBlock(sender);
    }
}
- (IBAction)textClick:(UITextField *)sender {
    
    if (self.endBlock) {
        self.endBlock(sender);
    }
}
- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    

}

@end
